Using ISMAP and ISINDEX with MacHTTP The following is a description of how to use ISINDEX and ISMAP with MacHTTP. ISINDEX is a tag returned at the beginning of a HTML document that indicates that the document accepts search arguments and returns some result of the search. MacHTTP performs searches by executing AppleScript functions. So, you MUST have AppleScript installed to use either ISINDEX or ISMAP tags within HTML documents served by MacHTTP. Important Note! Many of the following scripts depend on AppleScript extensions for performing text file I/O that are not part of the standard AppleScript distribution. These extensions (OSAXs) can be found in the "ScriptTools" package available from the usual Mac FTP sites. A reasonably current copy of ScriptTools can be downloaded from this server by clicking here. SEARCHING This AppleScript shows a way to access the http_search_args variable, extracting search arguments for further processing. -- This script demonstrates accessing searchable files from MacHTTP. -- (What it really shows is how to pass arguments to AppleScripts.) -- http_search_args is a predefined variable that is passed from the server -- to the script and contains the user-supplied arguments. If the arguments -- are empty, the script asks the WWW client to prompt for them. -- If arguments were passed, then the script behaves accordingly. -- Note: the HTML tag is what tells the client the document is searc hable -- and arguments should be collected and passed. if http_search_args = "" then return "

Please enter the keyword to search for.

" else if http_search_args = "hello" then return "

Hello, how are you?

" else return "

Sorry, I don't understand '" & http_search_args & "'. Try ' hello' instead.

" end if USING MAPS The following HTML document is a simple sample that shows how to present a clickable map. Note that it works in conjunction with the accompanying AppleScript to perform the map functions. Map

Map

Click on the map above.

abc
_________________________________________________________________ This is the AppleScript that interprets the search arguments containing the mouse click coordinates -- Interactive Campus Map Script -- to returnContents of returnFileName local fileText set fileText to "" try set refNum to open file alias returnFileName for reading on error return "Script Error

Couldn't find requested file

" end try repeat try set fileText to fileText & (read file refNum) & (ASCII character of 32) on error -- assume EOF hit exit repeat end try end repeat close file refNum return fileText end returnContents if http_search_args = "" then returnContents of "MapDocument.html" else set oldDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to {","} set x to first text item of http_search_args as integer set y to second text item of http_search_args as integer set AppleScript's text item delimiters to oldDelimiters if (x > topLeftX) and (x < botRightX) and (y > topLeftY) and (y < botRi ghtY) then returnContents of "HotSpotInfo.html" else returnContents of "Error.html" end if end if _________________________________________________________________ Many thanks to Dennis Wilkinson at the University of Massachusetts Dartmouth who figured out how to convince MacHTTP to serve up maps.